Skip to content

Improve AI credit balance meter - #4681

Merged
nightnei merged 5 commits into
trunkfrom
improve-ai-credits-meter
Sep 3, 2026
Merged

Improve AI credit balance meter#4681
nightnei merged 5 commits into
trunkfrom
improve-ai-credits-meter

Conversation

@shaunandrews

@shaunandrews shaunandrews commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Related issues

Fixes STU-2334

How AI was used in this PR

Assisted

Proposed Changes

With this PR we are adding AI credits balance meter to composer, which reflects the state from Settings -> Usage

Testing Instructions

See testing instruction here - #4758 as that PR adds the same meter to Classic UI. I decided to keep them as separate PRs to simplify review and to easier distinguish the changes added by me from Shaun's changes.

@shaunandrews
shaunandrews marked this pull request as ready for review August 25, 2026 14:56
@shaunandrews
shaunandrews requested review from a team and nightnei August 25, 2026 14:56
}

const remaining = ( quota.allowanceRemaining ?? 0 ) + ( quota.purchasedRemaining ?? 0 );
const usedFraction = quota.costCap > 0 ? quota.costUsage / quota.costCap : 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

costCap and costUsage - store info only about free allowance. We don't have functionality on the backend yet to return info costCapFOR_PURCHASED_CREDITS and costUsageFOR_PURCHASED_CREDITS.

Also, I remember you wanted to have this p1787155322763389/1787154068.417469-slack-C0BM2EL2Q7Q, which may even require effort from the Shilling team.

That's why I didn't include it in the initial release, since it's not a quick feature, it requires more effort than UI changes.

I propose closing this branch, and I will work on it later.

@wpmobilebot

wpmobilebot commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 5a60c1d vs trunk

app-size

Metric trunk 5a60c1d Diff Change
App Size (Mac) 1425.95 MB 1425.96 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 5a60c1d Diff Change
load 1214 ms 1251 ms +37 ms ⚪ 0.0%

site-startup

Metric trunk 5a60c1d Diff Change
siteCreation 7511 ms 7511 ms 0 ms ⚪ 0.0%
siteStartup 3380 ms 3373 ms 7 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@nightnei nightnei assigned nightnei and unassigned shaunandrews Aug 26, 2026
@nightnei
nightnei force-pushed the improve-ai-credits-meter branch from f7dba99 to ba8ca13 Compare August 31, 2026 14:55
@shaunandrews

Copy link
Copy Markdown
Contributor Author

Whats the latest here?

@nightnei

nightnei commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

@shaunandrews It's ready for review. See the Testing instructions section of thsi PR

}

.aiCreditsSummary[data-exhausted] strong {
color: var(--wpds-color-fg-content-error);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trunk has the new updated color token names, we'll need to reconcile these.

The PR’s new CSS still uses old names such as --wpds-color-fg-* and --wpds-color-bg-* in style.module.css (line 502). Current trunk uses --wpds-color-foreground-* and --wpds-color-background-*.

@shaunandrews

Copy link
Copy Markdown
Contributor Author

This looks great to me; Just the one note about the updated color token names.

@nightnei
nightnei force-pushed the improve-ai-credits-meter branch from 5bfc5c3 to 631e66f Compare September 3, 2026 10:59
@nightnei
nightnei force-pushed the improve-ai-credits-meter branch from 02e480d to 5a60c1d Compare September 3, 2026 11:30
@nightnei
nightnei merged commit d63aa77 into trunk Sep 3, 2026
13 checks passed
@nightnei
nightnei deleted the improve-ai-credits-meter branch September 3, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants